package org.huzhp.security;

import cn.hutool.crypto.digest.DigestUtil;
import org.springframework.security.crypto.password.PasswordEncoder;

public class Md5PasswordEncoder implements PasswordEncoder {


    @Override
    public String encode(CharSequence charSequence) {
        return DigestUtil.md5Hex(charSequence.toString());
    }

    @Override
    public boolean matches(CharSequence charSequence, String pwd) {
        return DigestUtil.md5Hex(charSequence.toString()).equals(pwd);
    }
}
